﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GcmpGraphicsNodeInterface.h"
#include "IGraphicsNode.h"
#include "WeakPtr.h"
#include "OwnerPtr.h"
#include "Matrix4d.h"

namespace gcmp 
{
    /// \brief 带有变换矩阵的图形节点
    struct GCMP_GRAPHICS_NODE_INTERFACE_EXPORT GraphicsNodeAndTransform
    {
        /// \brief 默认构造器
        GraphicsNodeAndTransform() : m_wpGraphicsNode(nullptr), m_opTransfrom(nullptr) {}

        /// \brief 复制构造器
        GraphicsNodeAndTransform(const GraphicsNodeAndTransform& graphicsNodeAndTransform);

        /// \brief 赋值操作符
        GraphicsNodeAndTransform& operator= (const GraphicsNodeAndTransform& graphicsNodeAndTransform);

        /// \brief 自定义构造器
        /// \param pGraphicsNode 原始图形节点
        /// \param opMat 变换矩阵
        GraphicsNodeAndTransform(const IGraphicsNode* pGraphicsNode, gcmp::OwnerPtr<gcmp::Matrix4d> opMatrix = nullptr)
            :m_wpGraphicsNode(pGraphicsNode), m_opTransfrom(TransferOwnership(opMatrix)){}

        /// \brief 原始图形节点
        gcmp::WeakPtr<const IGraphicsNode> m_wpGraphicsNode;

        /// \brief 变换矩阵
        gcmp::OwnerPtr<gcmp::Matrix4d> m_opTransfrom;
    };
}
